<%--
说明：资源账号下拉页面

@author liuxun 2012-03-06
--%>
<%@ include file="../../common/common.jsp"%>
<% 
response.setHeader("Pragma","No-cache");
response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires", 0);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta http-equiv="Expires" content="0"/>
<meta http-equiv="Cache-Control" content="no-cache"/>
<meta http-equiv="Pragma" content="no-cache"/>

<title>资源账号下拉</title>

<script>
//分别是：选中时的值（内码），显示名，是否选中，排序码（外码），级次
//第三个属性可以为空，表示没有选中
//如果不以树状形式显示，而是以普通列表形式显示，则只需要前面三项数据
//如果还需要存储其他属性，可以任意增加每行数组长度
var items = new Array();

<c:forEach var="each" items="${rows}" varStatus="s">

  var row=[
          "<c:out value="${each.rsc_acc}"/>",
          "<c:out value=""/>",
          <c:out value="${each.is_pull_down=='1'}"/>,
          "<c:out value="${each.rsc_acc}"/>",
          <c:out value="1"/>
       ];
  
  items[items.length]=row;
  
</c:forEach>

//实例化对象，参数分别是：要显示的列表数据，选择框的显示大小，是否以树状形式显示，是否显示层次码,显示风格,左侧提示,右侧提示
var list = new GBPSelectList(items,10,1,1,0,'未下拉账号','已下拉账号');
</script>

<script src="jsp/rscaccount/c_rsc_acc/c_usr_acc_pull_select.js" type="text/javascript" charset="UTF-8"></script>
</head>

<body>
  <form id="opeForm" name="opeForm" method="post" action="" >
  <input type="hidden" id="rsc_id" name="model.rsc_id" value="${model.rsc_id}" />
    <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td>
          <table border="0" cellpadding="0" cellspacing="0" style="width: 100%">
            <tr class="panel-header">
              <td>资源账号管理</td>
              <td valign="middle" nowrap align="right">
              	<a href="#" id="reloadBtn" class="easyui-linkbutton" plain="true" icon="icon-reload" onclick="refreshWin()">刷新</a> 
              	</td>
            </tr>
          </table>
          <table border=0 cellpadding=2 cellspacing=0 width="100%" class="queryTable">
            <tr class="queryTR">
              <td align="right" valign="middle" nowrap="nowrap">资源名称：</td>
              <td align="left" valign="middle" nowrap="nowrap">
              	<input type="text" id="rsc_name" name="model.rsc_name" class="editMainText" value="${model.rsc_name }" readonly="readonly" maxlength=150 /> 
              	<img onclick="select_c_rsc()" style="cursor: hand" title="选择" src="<c:url value="/images/eclipse/select.gif" />" /> &nbsp;</td>

              <td align="right" valign="middle" nowrap="nowrap"></td>
              <td align="left" valign="middle" nowrap="nowrap">

              <td align="left" valign="middle" width="100%">
              	<a href="javascript:void(0)" id="queryBtn" name="queryBtn" icon="icon-pull" class="easyui-linkbutton" onclick="queryPullOperation()">提取</a>
              	<a href="javascript:void(0)" id="clearBtn" name="clearBtn" icon="icon-cancel" class="easyui-linkbutton">清空</a>
              </td>
            </tr>
          </table>
          </td>
      </tr>
      <tr height="100%">
    <td class="editMainTD" colspan="2" align="center" style="height: 100%"><br>
      <script>
        //在适当的地方调用make()方法，输出组件
            list.make();
      </script>
    </td>
      </tr>
      
      <tr style="height: 40px">
        <td colspan="2" class="editMainBottomTD" style="height: 100%">&nbsp; 
            <a href="javascript:void(0)" id="okBtn" icon="icon-register" class="easyui-linkbutton" onclick="doOk()">登记</a>
        </td>
    </tr>
    <tr>
        <td colspan="2" class="editMainBottomTD" style="height: 100%">&nbsp;</td>
    </tr>
    <tr>
        <td colspan="2" class="editMainBottomTD" style="height: 100%">&nbsp;</td>
    </tr>    
    </table>	
  </form>
</body>
<script>
	function select_c_rsc(){
		var action = "C_RSC!showSelect.do";
		var row = showModalWin(action,'A2');
		
		if (row) {
			$('#rsc_id').val(row.rsc_id);
			$('#rsc_name').val(row.rsc_name);
		}
	}
	
	// 提取未下拉的资源账号
	function queryPullOperation(){
		
		var opeForm = $('#opeForm');
		var rsc_id = $('#rsc_id').val();
		
		alert(rsc_id);
		//return ;
		
		if(rsc_id == '' || rsc_id == null){
			showInfoWin('请选择资源名称！');
			return;
		}		
				
		//var params = opeForm.serializeObject();
		//pullGrid.datagrid("options").pageNumber = 1;
		//pullGrid.datagrid({
		//	url: 'C_RSC_ACC!queryPullListSelect.do',
		//	queryParams: jQuery.extend({}, params, {'firstQuery': true})
		//});
		
		  opeForm.attr('action', 'C_RSC_ACC!showPullAccIndex.do');
		  //opeForm.attr('target', 'hideWindow');
		  opeForm.submit();
	}

	function doOk() {
		alert();
		return;
		var usr_id = $('#usr_id').val();
		var rows=list.getRows();
		var params = '';
		
		if (rows.length > 0) {
			var ids = [];
			for(var i=0;i<rows.length;i++){
				ids.push(rows[i][0]);
			}
			params = $ .param({'id' : ids}, true);
		}

		showSystemProccessing();
		$.ajax({
			url: 'C_RSC_ACC!doInsert.do?model.usr_id=' + usr_id,
			data: params,
			type: 'post',
			success: function(data){
				removeSystemProccessing();
				showInfoWin('操作成功!', function() {window.close();});
			}
		});
	}
	
	function refreshWin(){
		window.location.reload();
	}

</script>
</html>